<template>
  <div>
    <el-form :model="todayCaseObj" label-width="120px" class="demo-ruleForm">
      <el-form-item label="主诉" prop="selfAbout">
        <el-input type="textarea" :rows="2" placeholder="请输入主诉" v-model="todayCaseObj.selfAbout" :disabled="disabled"/>
      </el-form-item>
      <el-form-item label="现病史" prop="nowDisease">
        <el-input type="textarea" :rows="2" placeholder="请输入现病史" v-model="todayCaseObj.nowDisease"  :disabled="disabled"/>
      </el-form-item>
      <el-form-item label="既往史" prop="pastDisease">
        <el-input type="textarea" :rows="2" placeholder="请输入既往史" v-model="todayCaseObj.pastDisease"  :disabled="disabled"/>
      </el-form-item>
      <el-form-item label="过敏史" prop="allergyHistory">
        <el-input type="textarea" :rows="2" placeholder="请输入过敏史" v-model="todayCaseObj.allergyHistory"  :disabled="disabled"/>
      </el-form-item>
      <el-form-item label="个人史" prop="persionHistory">
        <el-input type="textarea" :rows="2" placeholder="请输入个人史" v-model="todayCaseObj.persionHistory"  :disabled="disabled"/>
      </el-form-item>
      <el-form-item label="婚育史" prop="mfHistory">
        <el-input type="textarea" :rows="2" placeholder="请输入婚育史" v-model="todayCaseObj.mfHistory"  :disabled="disabled"/>
      </el-form-item>
      <el-form-item label="家族史" prop="familyHistory">
        <el-input type="textarea" :rows="2" placeholder="请输入家族史" v-model="todayCaseObj.familyHistory"  :disabled="disabled"/>
      </el-form-item>
      <el-form-item label="体格检查" prop="bodyCheck">
        <el-input type="textarea" :rows="2" placeholder="请输入体格检查" v-model="todayCaseObj.bodyCheck"  :disabled="disabled"/>
      </el-form-item>
      <el-form-item label="辅助检查" prop="auxiliaryCheck">
        <el-input type="textarea" :rows="2" placeholder="请输入辅助检查" v-model="todayCaseObj.auxiliaryCheck"  :disabled="disabled"/>
      </el-form-item>
      <el-form-item label="初步诊断" prop="pulse">
        <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="todayCaseObj.primaryDiagnosis"  :disabled="disabled"/>
      </el-form-item>
      <el-form-item label="治疗意见" prop="pulse">
        <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="todayCaseObj.treatmentOptions"  :disabled="disabled"/>
      </el-form-item>
      <el-form-item label="接诊医师">
        <el-input v-model="todayCaseObj.creatorName" disabled class="width220"/>
      </el-form-item>
      <el-form-item label="接诊时间">
        <el-date-picker v-model="todayCaseObj.createTime" disabled type="datetime" format="yyyy-MM-dd hh:mm:ss" placeholder="选择日期时间" class="width220"/>
      </el-form-item>
      <el-form-item v-if="!disabled">
        <el-button @click="saveForm('ruleForm')">保存</el-button>
        <el-button type="primary"  @click="submitForm('ruleForm')">提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import {submitHTreatmentRecord,inserthTreatmentRecord} from "plugins/axios/inquiryRecord.js";
export default {
  props:{
    hid:String,
    todayCaseObj:{
      type:Object,
      default:{}
    },
    disabled:{
      type:Boolean,
      default:false
    }
  },
  components: {},
  computed: {},
  data() {
    return {}
  },
  created() {},
  mounted(){},
  methods: {
    saveForm(){
      let self = this;
      let postData={...self.todayCaseObj,hid:self.hid}
      inserthTreatmentRecord(postData).then(res=>{
        self.$message("保存成功!");
        self.$emit('saveSuccess')
      })
    },
    submitForm(){
      let self = this;
      self.$confirm('今日病例确认，将无法修改今日病例', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let postData={...self.todayCaseObj,hid:self.hid}
          submitHTreatmentRecord(postData).then(res=>{
            self.$message("提交成功!");
            self.$emit('saveSuccess')
          })
        }).catch(() => {});
    },
  }
};
</script>
<style lang="stylus" scoped>
</style>